package com.wu.springcloud.fallback;

import com.wu.springcloud.service.HelloService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName MyFallbackFactory
 * @Author 浮生光
 * @Date 2022/6/2 22:02
 * @Description MyFallbackFactory
 * @Version 1.0
 */
@Component
public class MyFallbackFactory implements FallbackFactory<HelloService> {
    @Override
    public HelloService create(Throwable throwable) {
        return new HelloService() {
            @Override
            public String hello() {
                return throwable.getMessage();
            }
        };
    }
}
